home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!news
- From: jlilley@ix.netcom.com (John Lilley)
- Newsgroups: comp.lang.c++
- Subject: Re: new and multidimensional arrays
- Date: 24 Mar 1996 04:13:25 GMT
- Organization: Netcom
- Message-ID: <4j2i55$j4l@dfw-ixnews4.ix.netcom.com>
- References: <4il2rd$4fs@NNTP.MsState.Edu>
- NNTP-Posting-Host: den-co25-11.ix.netcom.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-NETCOM-Date: Sat Mar 23 10:13:25 PM CST 1996
- X-Newsreader: WinVN 0.99.7
-
- >if i have a method declared as:
- >setValues (int, int, float [][3])
- >how can i declare a dynamic array with new?
- >
- >i tried:
- >
- >float *variable[3];
- >
- >for (i=0; i<size; i++)
- > variable [i] = new float [3];
- >
- >but it doesnt work [the compiler says that there is no instance of
- >the above method that accepts that kind of a parameter.
-
-
- There are some types that are difficult (impossible) to declare in
- one line. I'd use a typedef, which is more readable. Or rather,
- not unreadable.
-
- typedef float float3[3];
- setValues (int, int, float3[])
-
- void glarp()
- {
- float3 *var;
-
- var = new float3[4];
- setValues(1,1,var);
- }
-
- john lilley
-
-